/**
 * @author LKQ
 * @date 2022/1/30 19:56
 * @description
 */
public class Solution {
    public static void main(String[] args) {
        Solution solution = new Solution();
        System.out.println(solution.findComplement(1));
    }
    public int findComplement(int num) {
        int ans = 0, count = 0;
        while (num != 0) {
            int left = num % 2 == 0 ? 1 : 0;
            ans += left * Math.pow(2, count);
            // num 右移1位
            num >>= 1;
            count++;
        }
        return ans;
    }
}
